<style type="text/css">
#content .details {
    width: 75%;
    margin: 15px auto;
    border: 1px solid #A9A9A9;
}

#content .details tr {
    background-color: #F2F2F2;
}

#content .details td {
    border: none;
    padding: 12px 5px;
}

#content .details td:nth-child(1) {
    text-align: right;
    width: 20%;
    min-width: 100px;
    font-size: 16px;
}

#content .members td {
    text-align: left;
    width: 25%;
}

#content .members td:nth-child(1) {
    text-align: center;
    width: 10%;
}

#content .members td:nth-child(4) {
    text-align: center;
    width: 10%;
}
</style>

<div id="content">
    <?php if ($group): ?>
        <?php if ($this->uri->segment(3) == 'group'): ?>
            <h2><?=ucwords($group['group_name']);?></h2>
            <table class="details">
                <tr><th colspan="2">Group Information</th></tr>
                <tr><td>Group Owner:</td><td><?=$group['owner_first'] . ' ' . $group['owner_last']; ?></td></tr>
                <tr><td>Group Type:</td><td><?=$group['group_type']; ?></td></tr>
                <tr><td>Description:</td><td><?=$group['group_description']; ?></td></tr>
            </table>
        <?php else: ?>
            <h2><?=ucwords($group[$this->uri->segment(3) . '_name']);?></h2>
            <table class="details">
                <tr><th colspan="2">Group Information</th></tr>
                <?php foreach ($group as $col => $value): ?>
                <tr><td><?=ucwords($col);?>:</td><td><?=$value;?></td></tr>
                <?php endforeach; ?>
            </table>
        <?php endif; ?>
    <?php endif; ?>

    <br /><br />

    <?php if (isset($members)): ?>
        <table class="members">
            <tr><th colspan="4">Top 10 Members</th></tr>
            <tr>
                <th>Rank</th>
                <th>Member Name</th>
                <?php if ($this->uri->segment(3) == 'group'): ?><th>Role</td><?php endif; ?>
                <th>Score</th>
            </tr>
            <?php foreach ($members as $rank => $member): ?>
                <tr>
                    <td><?=$rank + 1;?></td>
                    <td><?=$member['first_name'] . ' ' . $member['last_name'];?></td>
                    <?php if ($this->uri->segment(3) == 'group'): ?><td><?=$member['group_role'];?></td><?php endif; ?>
                    <td><?=$member['user_score'];?></td>
                </tr>
            <?php endforeach; ?>
        </table>
    <?php endif; ?>

    <br /><br />

     <table class="events">
        <tr><th>Event Name</th><th>Location</th><th>Event Date</th><th>Time</th></tr>
        <?php if (isset($events['upcoming'])): ?>
            <?php foreach ($events['upcoming'] as $index => $event): ?>
            <?php if ($index == 15) break; ?><tr>
                <td><a href="/student/event_details/<?=$event['event_id'];?>"><?=ucwords($event['event_name']);?></a></td>
                <td><?=$event['location_name'];?></td>
                <td><?=$event['start_date'];?></td>
                <td><?=$event['start_time'] . ' - ' . $event['end_time'];?></td>
            </tr><?php endforeach; ?>
        <?php endif; ?>
<tr><td class="divider" colspan="5">&nbsp;</td></tr>
        <?php if (isset($events['past'])): ?>
            <?php foreach ($events['past'] as $index => $event): ?>
            <?php if ($index == 15) break; ?><tr>
                <td><a href="/student/event_details/<?=$event['event_id'];?>"><?=ucwords($event['event_name']);?></a></td>
                <td><?=$event['location_name'];?></td>
                <td><?=$event['start_date'];?></td>
                <td><?=$event['start_time'] . ' - ' . $event['end_time'];?></td>
            </tr><?php endforeach; ?>
        <?php endif; ?>
    </table>
</div> <!-- #content -->